package com.gxa.web_admin.controller.operationscontroller;

import com.gxa.common.R;
import com.gxa.modules.pojo.Build;
import com.gxa.modules.pojo.Room;
import com.gxa.modules.service.operationsservice.LouYuXinXiGuanLiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/LouYuXinXi")
@Api(value = "资产管理模块",tags = "资产信息模块-楼宇信息管理模块API")
public class LouYuXinXiGuanLiController {

    @Autowired
    private LouYuXinXiGuanLiService louYuXinXiGuanLiService;

    @RequestMapping(value = "/selectLouYu",method = RequestMethod.GET)
    @ApiOperation(value = "查询楼宇信息",notes = "根据传入信息查询楼宇信息，传入参数条件查询，不传参数全部查询",httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "page",value = "页数",required = true,paramType = "query",dataType = "int"),
            @ApiImplicitParam(name = "limit",value = "每页条数",required = true,paramType = "query",dataType = "int")
    })
    public R selectLouYu(String buildName,int page,int limit){
        return louYuXinXiGuanLiService.selectLouYu(buildName,page,limit);
    }
    @RequestMapping(value = "/delLouYu",method = RequestMethod.POST)
    @ApiOperation(value = "删除楼宇信息",notes = "根据传入楼宇id删除楼宇信息,",httpMethod = "POST", response = R.class)
    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "所属楼宇",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "page",value = "页数",required = true,paramType = "query",dataType = "int"),
            @ApiImplicitParam(name = "ids",value = "想要删除的楼宇id,用,分隔回传String",required = true,paramType = "query",dataTypeClass = String.class)
    })
    public R delLouYu(@RequestParam String ids){
//        System.out.println(ids);
        return louYuXinXiGuanLiService.delLouYu(ids);
    }
    @RequestMapping(value = "/insertLouYu",method = RequestMethod.POST)
    @ApiOperation(value = "新增楼宇信息",notes = "新增楼宇信息,",httpMethod = "POST", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "ids",value = "想要删除的楼宇id,用,分隔回传String",required = true,paramType = "query",dataTypeClass = String.class)
//    })
    public R insertLouYu(@RequestBody Build build){
//        System.out.println(ids);
        return louYuXinXiGuanLiService.insertLouYu(build);
    }
    @RequestMapping(value = "/updLouYu",method = RequestMethod.POST)
    @ApiOperation(value = "修改楼宇信息",notes = "修改楼宇信息，楼宇id必传",httpMethod = "POST", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "ids",value = "想要删除的楼宇id,用,分隔回传String",required = true,paramType = "query",dataTypeClass = String.class)
//    })
    public R updLouYu(@RequestBody Build build){
//        System.out.println(ids);
        return louYuXinXiGuanLiService.updLouYu(build);
    }
    @RequestMapping(value = "/selectRoomByBuildId",method = RequestMethod.GET)
    @ApiOperation(value = "查询房间信息",notes = "根据楼宇Id查询楼宇房间信息",httpMethod = "GET", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
            @ApiImplicitParam(name = "id",value = "想要查询的楼宇id",required = true,paramType = "query",dataType = "int")
//    })
    public R selectRoomByBuildId(int id){
//        System.out.println(ids);
        return louYuXinXiGuanLiService.selectRoomByBuildId(id);
    }
    @RequestMapping(value = "/insertRoom",method = RequestMethod.POST)
    @ApiOperation(value = "添加房间信息",notes = "添加楼宇房间信息",httpMethod = "POST", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//    @ApiImplicitParam(name = "id",value = "想要查询的楼宇id",required = true,paramType = "query",dataType = "int")
//    })
    public R insertRoom(@RequestBody Room room){
//        System.out.println(ids);
        return louYuXinXiGuanLiService.insertRoom(room);
    }
}
